set more off

import excel using "demographics/2010 Census Data.xlsx", firstrow clear

rename STCOU fips
destring fips, replace
rename ResidentpopulationApril1c population
gen lpopulation = log(population + 1)
gen pctwhite = PopulationofoneraceWhitea / population
gen pct65plus = yearsandoverJuly1esti / population
gen lmedianincome = log(Medianhouseholdincomeinthep + 1)
gen unemployment = Inlaborforcecivilianlaborf / CivilianLaborForce2010 
gen pctpoverty = Peopleofallagesinpoverty / population
gen pcths = Highschoolgraduateincludese / population

label variable lpopulation "Ln Population"
label variable pctwhite "Pct White"
label variable pct65plus "Pct 65"
label variable lmedianincome "Ln Median Income"
label variable unemployment "Unemployment"
label variable pctpoverty "Poverty"
label variable pcths "Pct HS"

local myvars fips lpopulation pctwhite pct65plus lmedianincome unemployment pcths pctpoverty
keep `myvars'
order `myvars'

save "demographics/demographics", replace
